package com.hy.dao.impl;
/*
 * @ Date: 2024/5/14 22:35
 * @ Description: DepartmenttableDaoImpl
 **/

import com.hy.bean.Departmenttable;
import com.hy.dao.DepartmenttableDao;
import com.hy.exception.BizException;
import com.hy.utils.DBManager;
import org.apache.commons.dbutils.*;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

public class DepartmenttableDaoImpl implements DepartmenttableDao {

    private final QueryRunner queryRunner = new QueryRunner();

    BasicRowProcessor basicRowProcessor = new BasicRowProcessor(new GenerousBeanProcessor());


    @Override
    public Departmenttable queryById(Integer id) {
        return null;
    }

    @Override
    public List<Map<String, Object>> AllDepartmenttable(){
        Connection connection = null;
        String sql = "select id,departmentType from departmenttable";
        try {
            connection = DBManager.getConnection();
            return queryRunner.query(connection,sql,new MapListHandler());
        }catch (Exception e){
            throw new BizException("dao层异常");
        }finally {
            try {
                DbUtils.close(connection);
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }
    }

    @Override
    public List<Departmenttable> queryAllByLimit() {
        return null;
    }

    @Override
    public long count(Departmenttable departmenttable) {
        return 0;
    }

    @Override
    public int insert(Departmenttable departmenttable) {
        return 0;
    }

    @Override
    public int update(Departmenttable departmenttable) {
        return 0;
    }

    @Override
    public int deleteById(Integer id) {
        return 0;
    }
}
